home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1199 / 1711 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  1.1 KB

  1. Date: Fri, 15 Jul 94 09:19:11 BST
  2. From: djs@jet.uk (David Stevenson)
  3. Message-Id: <9407150819.AA18194@YE.jet.uk>
  4. To: evanlang@uss.lonestar.org
  5. In-Reply-To: <m0qOUWr-0004q4C@uss.lonestar.org> (evanlang@uss.lonestar.org)
  6. Subject: Re: Alignment
  7.  
  8.  
  9. >If I cast a const char * such as "MiNT" or "LIVE" to a long *, shouldn't
  10. >the compiler store the string so that it is aligned to a long boundary?
  11. No. If the object is declared as char * (with or without const) it can
  12. be aligned on any byte boundary by a 68K compiler.  Therefore it may
  13. be odd.  Casting to long* makes no difference, the compiler is not going
  14. to then move the string to align it.
  15.  
  16. >Otherwise, when trying to read the long at that address, it could be on
  17. >an odd address, and the machine dies.
  18. Address Error.
  19.  
  20. >Lately, that is the way I've been reading strings to compare to cookie tags.
  21. >It has always worked, but when I changed main.c in mint, it crashes and I'm
  22. >pretty sure its because the 68K can't read a long from an odd address.  Is
  23. >this a bug in the compiler, or is such a cast simply bad programming?
  24. Bad programming, I'm afraid.
  25.